/**
    ******************************************************************************
    * @file    threadPool.h
    * @author  debian
    * @version V1.0.0
    * @date    2020-07-29
    * @brief   线程池
    ******************************************************************************
    * @attention
    *
    *
    ******************************************************************************
    */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __THREADPOOL_H
#define __THREADPOOL_H

#ifdef __cplusplus
    extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include <pthread.h>
#include "async_queue_interner.h"

/** @addtogroup DataStruct_Driver
    * @{
    */

/** @addtogroup threadPool
    * @{
    */

/* Exported types ------------------------------------------------------------*/
/** @defgroup 
    * @{
    */ 
typedef struct threadPool_s
{
    pthread_t *thread_id;
    async_queue_t *queue;

    async_queue_op_t* op;

    int thread_count;

}threadPool_t;


typedef enum
{
    threadpool_cond_type     = 0,
    threadpool_eventfd_type  = 1,
    //threadpool_nowait_type   = 2   /* 忙等待 */
}threadpool_type_t;


/**
    * @}
    */


/* Exported constants --------------------------------------------------------*/

/* Exported macro ------------------------------------------------------------*/

/* Exported functions --------------------------------------------------------*/ 
/* Initialization and de-initialization functions *******************************/
/** @addtogroup threadPool_Exported_Functions
    * @{
    */

/** @addtogroup threadPool_Exported_Functions_Group1
    * @{
    */
    threadPool_t* threadPool_creat(int thread_count, int queue_size, threadpool_type_t type);
    int threadPool_destroy(threadPool_t* pool);
    int threadPool_add(threadPool_t* pool, void *(*run)(void *), void *arg);
    
/**
    * @}
    */

/* operation functions *******************************************************/
/** @addtogroup threadPool_Exported_Functions_Group2
    * @{
    */



/**
    * @}
    */

/**
    * @}
    */ 

/**
    * @}
    */

/**
    * @}
    */


#ifdef __cplusplus
}
#endif

#endif /* __THREADPOOL_H */

/******************* (C) 2020 HOME 深圳龙华 *****END OF FILE****/

